home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.4 Applications 1997 August / SGI IRIX 6.4 Applications 1997 August.iso / dist / gateway.idb / usr / WebFace / Tasks / connect-t1.cgi.z / connect-t1.cgi
Encoding:
Text File  |  1997-07-30  |  4.4 KB  |  167 lines

  1. #!/usr/bin/perl5
  2. #
  3. # connect-t1.cgi
  4. #
  5. # Copyright 1988-1996 Silicon Graphics, Inc.
  6. # All rights reserved.
  7. #
  8. # This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  9. # the contents of this file may not be disclosed to third parties, copied or
  10. # duplicated in any form, in whole or in part, without the prior written
  11. # permission of Silicon Graphics, Inc.
  12. #
  13. # RESTRICTED RIGHTS LEGEND:
  14. # Use, duplication or disclosure by the Government is subject to restrictions
  15. # as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  16. # and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  17. # successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  18. # rights reserved under the Copyright Laws of the United States.
  19. #
  20. # $Id: connect-t1.cgi,v 1.29 1997/04/17 23:43:44 shotes Exp $
  21.  
  22. require "/usr/OnRamp/lib/OnRamp.pm";
  23.  
  24. if (!$ARGV[0]) { printf("Location: %s%c%c","/tasks/Tasks.connect-start.cgi",10,10); } 
  25.  
  26. $myname = "connect-t1.cgi";
  27. $temp = "task.tmp";
  28. $action= "connect-t1.cgi?loop";
  29.  
  30. $it = "<td align=right><font size=4>";
  31. $ni = "</font></td>";
  32. $bo = "<td><br><font size=5><i>";
  33. $nb = "</i></font></td>";
  34.  
  35. @find_vals = ('port');
  36.  
  37. &get_fields;
  38.  
  39. if ($ARGV[0] eq 'loop') { %vals = %fld; }
  40. else { &readValues; }
  41.  
  42. if ($ARGV[0] eq loop) {
  43.     &errorCheck;
  44.     &writeFile;
  45.  
  46.     $go = "/tasks/connect-end.cgi?t";
  47.     #printf("Location: %s%c%c",$go,10,10); 
  48.     print "Content-type: text/html\n\n";
  49.     print "<HTML><HEAD>";
  50.     print "<META HTTP-EQUIV=\"refresh\" CONTENT=\"0; URL=$go\">";
  51.     print "</HEAD><BODY></BODY></HTML>";
  52.     exit 0;
  53. }
  54.  
  55.  
  56. &generic;
  57.  
  58. sub readValues {
  59.     open(IN,"< $temp");
  60.     while(<IN>) {
  61.     @items = split(/=/);
  62.     foreach $arg (@find_vals) {
  63.         if ($arg eq $items[0]) { 
  64.         if ($items[1] ne "\n") {
  65.             $vals{$arg} = $items[1];
  66.             chop $vals{$arg};
  67.         }
  68.         }
  69.     }
  70.     }
  71.     close(IN);
  72. }
  73.  
  74. sub errorCheck {
  75. }
  76.  
  77. sub error {
  78.     $error = $_[0];
  79.     &generic;
  80.     exit 0;
  81. }
  82.     
  83. sub writeFile {
  84.     undef %terms;
  85.     open(IN,"< $temp");
  86.     while(<IN>) {
  87.         @items = split(/=/);
  88.         chop $items[1];
  89.         $terms{$items[0]} = $items[1];
  90.     }
  91.     close(IN);
  92.     foreach $arg (@find_vals) {
  93.         $terms{$arg} = $fld{$arg};
  94.     }
  95.     open(OUT,"> $temp");
  96.     foreach $arg (keys(%terms)) {
  97.         print OUT "$arg=$terms{$arg}\n";
  98.     }
  99.     close(OUT);
  100. }
  101.  
  102. sub generic {
  103.     print "Content-type: text/html\n\n";
  104.     print "<html><head><title>T1 Configuration</title>\n";
  105.     print "<script language=\"JavaScript\">\n<!--\n";
  106.  
  107.     # JavaScript
  108. print "function Next()  {
  109.     setTimeout('document.t1.submit()',0);
  110.     return;
  111. }\n";
  112. print "function Previous()  {
  113.     setTimeout('window.location=\"connect-second.cgi?t\"',0);
  114.     return;
  115. }\n";
  116. print "function errorBox (Ctrl, ErrorMessage) {
  117.     alert (ErrorMessage);  Ctrl.focus();  return;
  118. }\n";
  119.  
  120. print "//-->\n";
  121. print "</script></head>\n\n";
  122.  
  123.     print "<body bgcolor=\'c7ded4\' background=/tasks/connect-task.bg.gif>\n";
  124.  
  125.     if ($error) {
  126.         print "<font size=4><b>Error: </b>$error<br></font>";
  127.     }
  128.     print "<i>$message</i>";
  129.  
  130.     print "<table width=100%>",
  131.           "<tr><th align=left><h1>T1 Configuration</h1></th>\n",
  132.           "<th align=right><a href=\"/newsplash.shtml\">",
  133.           "<img height=55 width=57 border=0 src=/tasks/home.gif></a>\n",
  134.           "  <a href=\"/tasks/Tasks.shtml\">",
  135.           "<img height=55 width=57 border=0 src=/tasks/back.gif></a>",
  136.           "</tr></table>\n";
  137.  
  138.     printf("<form name=\"t1\" action=\"%s\" method=post>\n", $action);
  139.     
  140.     print "<center><table width=620>";
  141.  
  142.     print "<tr valign=top>$bo Port for your T1 connection: <br> <br> <br> <br>$nb \n$it", 
  143.           &select("port",$vals{'port'},
  144.           'Port 1',
  145.           'Port 2'), 
  146.           "<br> <br>$ni</tr>\n";
  147.  
  148.     print "</table></center>\n";
  149.  
  150.     print '<MAP NAME="js_map1">',
  151.     '    <AREA SHAPE="rect" COORDS="0,0,59,52" HREF="javascript:Previous()"
  152.     onMouseOver="window.status=\'\';return true">',
  153.     '</MAP>';
  154.     print "\n";
  155.     print '<MAP NAME="js_map2">',
  156.     '    <AREA SHAPE="rect" COORDS="0,0,59,52" HREF="javascript:Next()"
  157.     onMouseOver="window.status=\'\';return true">',
  158.     '</MAP>';
  159.     print "\n";
  160.     print '<IMG SRC="/tasks/rightarrow.gif" BORDER=0 USEMAP="#js_map2" align="right">';
  161.     print "\n";
  162.     print '<IMG SRC="/tasks/leftarrow.gif" BORDER=0 USEMAP="#js_map1" align="right">';
  163.  
  164.     print "\n</form></body></html>";
  165. }
  166.  
  167.